#!/bin/sh

for i in $PLIBDIRS # $PLIBDIRS is exported in 2createpackages
do
	[ -d $i ] || continue
	
	#to support apps compiled for older x264...
	FNDLIB="`ls ${i}/libx264.so.* 2>/dev/null | head -n 1`"
	if [ -f "$FNDLIB" ];then
		BASELIB=${FNDLIB##*/} #"`basename $FNDLIB`"
		BASENUM="`echo -n "$BASELIB" | rev | cut -f 1 -d '.' | rev`" #ex: libx264.so.115 becomes 115
		[ $BASENUM -gt 152 ] && ln -sv $BASELIB ${i}/libx264.so.152
		[ $BASENUM -gt 148 ] && ln -sv $BASELIB ${i}/libx264.so.148
		[ $BASENUM -gt 142 ] && ln -sv $BASELIB ${i}/libx264.so.142
		[ $BASENUM -gt 123 ] && ln -sv $BASELIB ${i}/libx264.so.123
		[ $BASENUM -gt 116 ] && ln -sv $BASELIB ${i}/libx264.so.116
		[ $BASENUM -gt 105 ] && ln -sv $BASELIB ${i}/libx264.so.105
		[ $BASENUM -gt 98 ] && ln -sv $BASELIB ${i}/libx264.so.98
		[ $BASENUM -gt 94 ] && ln -sv $BASELIB ${i}/libx264.so.94
	fi
done
